FROM openresty/openresty:1.27.1.2-4-alpine-fat

# 安装系统依赖
RUN apk add --no-cache \
    curl \
    git \
    gcc \
    g++ \
    musl-dev \
    make \
    openssl-dev \
    pkgconfig \
    cmake \
    autoconf \
    automake \
    libtool 


ENV TZ=Asia/Shanghai
    
# ENV LUAROCKS_VERSION=3.9.1    

RUN /usr/local/openresty/luajit/bin/luarocks install luasec

# 安装OPM（OpenResty包管理器）
RUN /usr/local/openresty/luajit/bin/luarocks install lua-resty-openssl
RUN /usr/local/openresty/luajit/bin/luarocks install lua-cjson
RUN /usr/local/openresty/luajit/bin/luarocks install luasocket
RUN /usr/local/openresty/luajit/bin/luarocks install lua-resty-http
RUN /usr/local/openresty/luajit/bin/luarocks install lua-protobuf
#RUN /usr/local/openresty/luajit/bin/luarocks install lua-resty-jwt



# 复制自定义配置和脚本
COPY config/nginx.conf /opt/openresty/nginx/conf/nginx.conf
COPY config/ /etc/nginx/
COPY lua/ /usr/local/openresty/site/lualib/

EXPOSE 80 443 

CMD ["/usr/local/openresty/nginx/sbin/nginx", "-g", "daemon off;"]

